import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router);

import Home from '@/page/center/Home'

const routes = [
  {
    path: '/',
    component: resolve => require(['@/page/center/Login'], resolve)
  },
  //用户列表
  {
    path: '/manage',
    component: Home,
    children: [
      {
        path: '/HomeIndex',
        component: resolve => require(['@/page/center/HomeIndex'], resolve),
        meta: [],
      },
      {
        path: '/UserList',
        component: resolve => require(['@/page/center/UserList'], resolve),
        meta: ['管理', '用户列表'],
      },
      {
        path: '/ShopList',
        component: resolve => require(['@/page/center/ShopList'], resolve),
        meta: ['管理', '商家列表'],
      },
      {
        path: '/FoodList',
        component: resolve => require(['@/page/center/FoodList'], resolve),
        meta: ['管理', '食品列表'],
      },
      {
        path: '/OrderList',
        component: resolve => require(['@/page/center/OrderList'], resolve),
        meta: ['管理', '订单列表'],
      },
      {
        path: '/AdminList',
        component: resolve => require(['@/page/center/AdminList'], resolve),
        meta: ['管理', '管理员列表'],
      },
      {
        path: '/AddShop',
        component: resolve => require(['@/page/center/AddShop'], resolve),
        meta: ['数据', '添加商铺'],
      },
      {
        path: '/AddGoods',
        component: resolve => require(['@/page/center/AddGoods'], resolve),
        meta: ['数据', '添加商品'],
      },
      {
        path: '/Visitor',
        component: resolve => require(['@/page/center/Visitor'], resolve),
        meta: ['图表', '用户分布'],
      },
      {
        path: '/VueEdit',
        component: resolve => require(['@/page/center/VueEdit'], resolve),
        meta: ['编辑', '文本编辑'],
      },
      {
        path: '/AdminSet',
        component: resolve => require(['@/page/center/AdminSet'], resolve),
        meta: ['设置', '管理员设置'],
      },
      {
        path: '/Explain',
        component: resolve => require(['@/page/center/Explain'], resolve),
        meta: ['说明', '说明'],
      }]
  }
];

export default new Router({
  routes: routes,
  mode: 'history',
  base: '/admin/',
  scrollBehavior() {
    return {x: 0, y: 0}
  }
});
